<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<title>政策制度添加</title>
	<link rel="stylesheet" href="__PUBLIC__/Policy/css/weui.min.css">
	<link rel="stylesheet" href="__PUBLIC__/Policy/css/bootstrap.min.css">
	<script src="__PUBLIC__/Policy/js/jquery-1.8.2.min.js"></script>
</head>
<body>
	<div style="text-align: center;margin-top:4%; margin-bottom:4%">
		<img src="__PUBLIC__/Policy/img/logo.png" alt="logo" width="40%">
	</div>
	<form action="" method="post">
		<div class="weui-cells weui-cells_form">
		    <div class="weui-cell">
		        <div class="weui-cell__hd"><label class="weui-label">添加内容</label></div>
		        <div class="weui-cell__bd">
		            <input class="weui-input" type="text"  name="content" placeholder="请您输入内容"/>
		        </div>
		    </div>
		    <div class="weui-cell">
		        <div class="weui-cell__hd"><label class="weui-label">添加链接</label></div>
		        <div class="weui-cell__bd">
		            <input class="weui-input" type="text" name="link" placeholder="请您输入链接"/>
		        </div>
		    </div>
		</div>
		<table class="table">
			<tr>
				<td>
					<button type="reset" class="weui-btn weui-btn_warn">重新填写</a>
				</td>
				<td>	
					<button  type="button" class="weui-btn weui-btn_primary submits" >确认提交</a>
				</td>
			</tr>
		</table>
	</form>

	<div class="weui-loadmore" style="display:none">
	    <i class="weui-loading"></i>
	    <span class="weui-loadmore__tips">正在提交中！</span>
	</div>
	 <div class="weui-footer" id="footer">
                    <p class="weui-footer__links">
                        <a href="javascript:void(0);" class="weui-footer__link">中国航天-神舟软件</a>
                    </p>
                    <p class="weui-footer__text">Copyright &copy; 2008-2016 </p>
                </div> 


<div class="js_dialog" id="iosDialog2" style="display: none;">
                <div class="weui-mask"></div>
                <div class="weui-dialog">
                    <div class="weui-dialog__bd">没有相关数据请联系管理人员</div>
                    <div class="weui-dialog__ft">
                        <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary" id="qr">确定</a>
                    </div>
                </div>
            </div>

</body>    
<script>
	$('.weui-loadmore').hide();
	$('#iosDialog2').hide();
	$(function(){
		$('.submits').click(function(){
			var content = $('input[name=content]').val();
			var link = $('input[name=link]').val();
			if(!content){
				$('#iosDialog2').show();
				$('.weui-dialog__title').text('内容不能为空');
				$('.weui-dialog__bd').text('请填写您要输入的内容');
				
				return false;

			}
			if(!link){
				$('#iosDialog2').show();
				$('.weui-dialog__title').text('链接不能为空');
				$('.weui-dialog__bd').text('请填写您要输入的链接');
				return false;
			}
			$('.weui-loadmore').show();
			$.post("{:U('Policy/Index/add')}",{'content':content,'link':link},function(data){
				if(data == 1){
					$('.weui-loadmore').hide();
					location.href = '{:U("Policy/Index/msg")}';
				}else{
					location.href = '{:U("Policy/Index/fail")}';
				}
			})
			
		})
		$('#qr').click(function(){
			$('#iosDialog2').hide();
		})
	})
</script>
<style>
	body {
              font-family:Microsoft YaHei;
           }
            #footer{
                margin-top:30%;
          }
</style>
</html>
